<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <table>
        <tr style="background: rgb(255, 255, 255);">
            <td>ID</td>
            <td>姓名</td>
            <td>性别</td>
            <td>年龄</td>
            <td>地址</td>
            <td>操作</td>
        </tr>
        <tr style="background: rgb(239, 239, 239);">
            <td>1</td>
            <td>张三</td>
            <td>男</td>
            <td>18</td>
            <td>中国</td>
            <td><a>删除</a></td>
        </tr>
        <tr style="background: rgb(255, 255, 255);">
            <td>2</td>
            <td>李四</td>
            <td>男</td>
            <td>18</td>
            <td>中国</td>
            <td><a>删除</a></td>
        </tr>
        <tr style="background: rgb(239, 239, 239);">
            <td>3</td>
            <td>王五</td>
            <td>男</td>
            <td>18</td>
            <td>中国</td>
            <td><a>删除</a></td>
        </tr>
        <tr style="background: rgb(255, 255, 255);">
            <td>4</td>
            <td>麻子</td>
            <td>男</td>
            <td>18</td>
            <td>中国</td>
            <td><a>删除</a></td>
        </tr>
        <tr style="background: rgb(239, 239, 239);">
            <td>2</td>
            <td>李四</td>
            <td>男</td>
            <td>18</td>
            <td>中国</td>
            <td><a>删除</a></td>
        </tr>
        <tr style="background: rgb(255, 255, 255);">
            <td>3</td>
            <td>王五</td>
            <td>男</td>
            <td>18</td>
            <td>中国</td>
            <td><a>删除</a></td>
        </tr>
        <tr style="background: rgb(239, 239, 239);">
            <td>4</td>
            <td>麻子</td>
            <td>男</td>
            <td>18</td>
            <td>中国</td>
            <td><a>删除</a></td>
        </tr>
    </table>
    <script>
        var aList = document.querySelectorAll('table tr td a');
        for (let i = 0; i < aList.length; i++) {
            const a = aList[i];
            a.onclick = function(){
                this.parentNode.parentNode.parentNode.removeChild(
                    this.parentNode.parentNode
                )
            }
        }
    </script>
</body>

</html>